<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>学校管理</title>
	<meta name="decorator" content="default"/>
    <link href="${ctxStatic}/bootstrap/plugins/chose/chosen.css" type="text/css" rel="stylesheet" />
    <style>
        table#contentTable  td {
            vertical-align: middle;
        }

    </style>
</head>
<body>
<div class="main-content">
    <tags:breadcrumb menuId="学校管理" />
    <tags:message content="${message}"/>
    <div class="page-content">
        <div class="search-block" style="display:block;">
            <form:form id="searchForm" modelAttribute="school" action="${ctx}/school/school/" method="post" class="form-horizontal">
                <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
                <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
                <div class="form-group" style="margin-bottom: 0px;">
                    <label class="col-sm-1 no-padding-right control-label">学校名称：</label>
                    <div class="col-sm-3">
                        <form:input path="schoolName" htmlEscape="false" maxlength="32" class="col-sm-10"/>
                    </div>
                    <label class="col-sm-1 no-padding-right control-label">省：</label>
                    <div class="col-sm-2">
                        <form:select path="provice" cssClass="col-sm-10 chosen-select">
                            <form:option value="" label="-请选择-"/>
                            <form:options items="${provinceList}" itemLabel="name" itemValue="id"/>
                        </form:select>
                    </div>
                    <label class="col-sm-1 no-padding-right control-label">办学性质：</label>
                    <div class="col-sm-2">
                        <form:select path="bxType" cssClass="col-sm-8 required chosen-select">
                            <form:option value="" label="-请选择-"/>
                            <form:options items="${fns:getDictList('bx_type')}" itemValue="value" itemLabel="label"/>
                        </form:select>
                    </div>
                </div><hr>
                <div class="form-group" style="margin-bottom: 0px;">
                    <div class="col-sm-8" style="padding-top:6px;">
                        <label style="margin-right: 10px;">
                            <input name="flag211" type="checkbox" class="ace" value="1" <c:if test="${param.flag211 eq '1'}">checked</c:if>/>
                            <span class="lbl"> 是否211</span>
                        </label>
                        <label style="margin-right: 10px;">
                            <input name="flag985" type="checkbox" class="ace" value="1" <c:if test="${param.flag985 eq '1'}">checked</c:if>/>
                            <span class="lbl"> 是否985</span>
                        </label>
                        <label style="margin-right: 10px;">
                            <input name="flagGuo" type="checkbox" class="ace" value="1" <c:if test="${param.flagGuo eq '1'}">checked</c:if>/>
                            <span class="lbl"> 是否有国防生</span>
                        </label>
                        <label style="margin-right: 10px;">
                            <input name="flagYan" type="checkbox" class="ace" value="1" <c:if test="${param.flagYan eq '1'}">checked</c:if>/>
                            <span class="lbl"> 是否有研究生院</span>
                        </label>
                        <label style="margin-right: 10px;">
                            <input name="flagZhuo" type="checkbox" class="ace" value="1" <c:if test="${param.flagZhuo eq '1'}">checked</c:if>/>
                            <span class="lbl"> 是否属于卓越计划</span>
                        </label>
                        <label style="margin-right: 10px;">
                            <input name="flagZi" type="checkbox" class="ace" value="1" <c:if test="${param.flagZi eq '1'}">checked</c:if>/>
                            <span class="lbl"> 是否自主招生</span>
                        </label>
                    </div>
                    <div class="col-sm-3">
                        <input id="btnSubmit" class="btn btn-primary btn-sm" type="submit" value="查询"/>
                        <input id="btnImport" class="btn btn-inverse btn-sm" type="button" value="导入"/>
                        <input id="btnExport" class="btn btn-warning btn-sm" type="button" value="导出"/>
                    </div>
                </div>
            </form:form>
        </div>
        <table id="contentTable" class="table table-striped table-bordered table-condensed">
            <thead>
            <tr>
                <th>排名</th>
                <th>校徽</th>
                <th>学校名称</th>
                <th>省份</th>
                <th>学校统计</th>
                <th>学校特点</th>
                <th>学校标签</th>
                <th>隶属</th>
                <th>学校性质</th>
                <th>更新人员</th>
                <shiro:hasPermission name="school:school:edit"><th>操作</th></shiro:hasPermission>
            </tr>
            </thead>
            <tbody>
            <c:forEach items="${page.list}" var="school">
                <tr>
                    <td>
                        <span class="badge" style="background-color: #322DCA;">${school.schoolRanking}</span>
                    </td>
                    <td>
                        <a href="${ctx}/school/school/form?id=${school.id}"><img src="${school.schoolLogo}" width="60" height="60"/></a>
                    </td>
                    <td>
                        <h5><b><a href="${ctx}/school/school/form?id=${school.id}"> ${school.schoolName}</a></b></h5>
                        <span class="label label-info">国标：${school.schoolCode}</span><br>
                        <span class="label label-info">省标：${school.schoolCodeSn}</span><br>
                    </td>
                    <td>
                            ${school.provice}
                    </td>
                    <td style="width: 10%;word-break: break-all;padding: 2px;">
                        <span class="label label-info">硕士点：${school.masterPoint}</span><br>
                        <span class="label label-info">博士点: ${school.doctorPoint}</span><br>
                        <span class="label label-info">重点学科：${school.zdxkNum}</span>
                        <span class="label label-info">男女比例：${school.maleFemale}</span>
                    </td>
                    <td style="width: 10%;word-break: break-all;padding: 2px;">
                        <c:if test="${!empty school.flag211 || school.flag211 eq '0'}"><span class="label label-success">211</span></c:if>
                        <c:if test="${!empty school.flag985 || school.flag985 eq '0'}"><span class="label label-success">985</span></c:if>
                        <c:if test="${!empty school.flagGuo || school.flagGuo eq '0'}"><span class="label label-success">国防生</span></c:if>
                        <c:if test="${!empty school.flagYan || school.flagYan eq '0'}"><span class="label label-success">研究院</span></c:if>
                        <c:if test="${!empty school.flagZhuo || school.flagZhuo eq '0'}"><span class="label label-success">卓越计划</span></c:if>
                        <c:if test="${!empty school.flagZi || school.flagZi eq '0'}"><span class="label label-success">自主招生</span></c:if>
                    </td>
                    <td style="width: 10%;word-break: break-all;padding: 2px;">
                        <c:choose>
                            <c:when test="${not empty school.schoolLabels}">
                                <c:forEach items="${fn:split(school.schoolLabels,'|')}" var="label">
                                    <span class="label label-danger">${label}</span>
                                </c:forEach>
                            </c:when>
                            <c:otherwise>无</c:otherwise>
                        </c:choose>
                    </td>
                    <td>
                            ${school.owns}
                    </td>
                    <td style="width: 10%;word-break: break-all;padding: 2px;">
                        <span class="label label-info" title="学校类型">${fns:getDictLabel(school.schoolType,'school_type','无')}</span><br>
                        <span class="label label-info" title="办学性质">${fns:getDictLabel(school.bxType,'bx_type','无')}</span>
                    </td>
                    <td>
                            ${school.updateBy}
                    </td>
                    <shiro:hasPermission name="school:school:edit">
                        <td style="width: 15%;word-break: break-all;padding: 2px;">
                        <a href="${ctx}/school/school/form?id=${school.id}" class="btn btn-info btn-mini">修改</a>
                        <a href="${ctx}/school/school/delete?id=${school.id}" class="btn btn-danger btn-mini" onclick="return confirmx('确认要删除该学校吗？', this.href)">删除</a>
                        <a href="${ctx}/school/school/marjorSettingForm?id=${school.id}" class="btn btn-info btn-mini">管理专业</a>
                        <a href="${ctx}/school/school/lqForm?id=${school.id}" class="btn btn-info btn-mini">学校录取线</a>
                        <a href="${ctx}/score/lqMajor/form?schoolCode=${school.schoolCode}" class="btn btn-info btn-mini">专业录取线</a>
                        <a href="${ctx}/school/enrollmentPlan/form?schoolCode=${school.schoolCode}" class="btn btn-info btn-mini">招生计划表</a>
                        </td>
                    </shiro:hasPermission>
                </tr>
            </c:forEach>
            </tbody>
        </table>
        <div class="pagination">${page}</div>
    </div>
</div>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">学校导入</h4>
            </div>
            <div class="modal-body">
                <form id="importForm" action="${ctx}/school/school/import" enctype="multipart/form-data"  method="post" class="form-horizontal">
                    <div class="form-group">
                        <label class="col-sm-2 no-padding-right control-label">模板名称:</label>
                        <div class="col-sm-8">
                            <input id="uploadFile" name="file" type="file" style="width:330px"/><br/><br/>
                            <span class="important">*</span>
                        </div>
                        <div col-sm-2>
                            <a href="${ctx}/school/school/import/template">下载模板</a>
                        </div>
                    </div><hr>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" id="btnSureImport">确定</button>
            </div>
        </div>
    </div>
</div>
<script src="${ctxStatic}/bootstrap/plugins/chose/chosen.jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function() {
        $(".chosen-select").chosen();
        //显示高级查询
        $(".search_link").click(function(){
            if($(".search-block").is(":visible")){
                $(".search-block").hide();
                $(".search_link").text("高级查询");
            }else{
                $(".search-block").show();
                $(".search_link").text("隐藏查询");
            }
        });

        //导出
        $("#btnExport").click(function(){
            layer.confirm("确认要导出学校数据吗？",function(index){
                layer.close(index);
                $("#searchForm").attr("action","${ctx}/school/school/export");
                $("#searchForm").submit();
            });
        });

        //导入
        $("#btnImport").click(function(){
            $("#myModal").modal({
                backdrop:"static"
            });
        });

        //确定导入
        $("#btnSureImport").click(function(){
            $("#importForm").submit();
        });
    });
    function page(n,s){
        $("#pageNo").val(n);
        $("#pageSize").val(s);
        $("#searchForm").submit();
        return false;
    }
</script>
</body>
</html>